package com.zj.fx.controller.gen;

import com.zj.fx.common.base.BaseController;
import com.zj.fx.common.domain.AjaxResult;
import com.zj.fx.common.domain.ResultTable;
import com.zj.fx.model.custom.Tablepar;
import com.zj.fx.model.auto.AutoOriimport;
import com.zj.fx.service.AutoOriimportService;
import com.github.pagehelper.PageInfo;
import com.zj.fx.util.ReadExcelUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * 月度数据导入数据原始表Controller
 * @ClassName: AutoOriimportController
 * @author SQL
 * @date 2024-02-26 09:55:53
 */
@Api(value = "月度数据导入数据原始表")
@Controller
@RequestMapping("/AutoOriimportController")
public class AutoOriimportController extends BaseController {

    private String prefix = "gen/autoOriimport";

    @Autowired
    private AutoOriimportService autoOriimportService;


    /**
     * 月度数据导入数据原始表页面展示
     * @param model
     * @return String
     * @author SQL
     */
    @ApiOperation(value = "分页跳转", notes = "分页跳转")
    @GetMapping("/view")
    @RequiresPermissions("gen:autoOriimport:view")
    public String view(ModelMap model) {
        return prefix + "/list";
    }

    /**
     * list集合
     * @param tablepar
     * @param
     * @return
     */
    //@Log(title = "月度数据导入数据原始表", action = "111")
    @ApiOperation(value = "分页跳转", notes = "分页跳转")
    @GetMapping("/list")
    @RequiresPermissions("gen:autoOriimport:list")
    @ResponseBody
    public ResultTable list(Tablepar tablepar,AutoOriimport autoOriimport) {
        PageInfo<AutoOriimport> page = autoOriimportService.list(tablepar,autoOriimport);
        return pageTable(page.getList(), page.getTotal());
    }

    /**
     * 月度数据导入数据原始表页面展示
     * @param model
     * @return String
     * @author SQL
     */
    @ApiOperation(value = "分页跳转", notes = "分页跳转")
    @GetMapping("/include")
    public String to(ModelMap model) {
        return prefix + "/include";
    }

    @ResponseBody
    @RequestMapping(value = { "/uploadAutoOriimport" })
    public Map<String, Object> uploadAutoOriimport(MultipartFile file) throws Exception {
        return autoOriimportService.addOrganizationInfo(file);
    }
}
